//
//  MBMusicCell.m
//  MiBaoTu
//
//  Created by 彭鹏 on 16/9/18.
//  Copyright © 2016年 com.caesartech15. All rights reserved.
//

#import "MBMusicCell.h"

@implementation MBMusicCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setDataDic:(NSDictionary *)dataDic
{
    _dataDic = dataDic;
    [self setNeedsLayout];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    if (_dataDic) {
        NSString *imgPath = [_dataDic objectForKey:@"MainPicture"];
        if (![imgPath isKindOfClass:[NSNull class]]) {
            [_musicIcon sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",MUSIC_PLAY_Url,imgPath]] placeholderImage:[UIImage imageNamed:@"online_list_bg"]];
        }else{
            _musicIcon.image=[UIImage imageNamed:@"online_list_bg"];
        }
        _musicIcon.layer.cornerRadius = 5.;
        _musicIcon.layer.masksToBounds = YES;
        
        NSString*RadioName;
        if ([_dataDic.allKeys containsObject:@"RadioName"]) {
            RadioName=[NSString stringWithFormat:@"%@",[_dataDic objectForKey:@"RadioName"]];
        }
        else if ([_dataDic.allKeys containsObject:@"RaduiName"]) {
            RadioName=[NSString stringWithFormat:@"%@",[_dataDic objectForKey:@"RaduiName"]];
        }
        _musicLb.text=RadioName;

    }
}

@end
